package A11_阻塞队列_BlockQueue;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

/**
 * @Author: KingWang
 * @Date: 2021/5/23
 * @Desc:
 **/
public class BlockQueueDemo {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<String> queue = new ArrayBlockingQueue<>(3);

//        //进入队列
//        System.out.println(queue.add("a"));
//        System.out.println(queue.add("b"));
//        System.out.println(queue.add("c"));
////        System.out.println(queue.add("d"));
//        System.out.println(queue.element());
//        //出队列
//        System.out.println(queue.remove());
//        System.out.println(queue.remove());
//        System.out.println(queue.remove());
////        System.out.println(queue.remove());

//        System.out.println(queue.offer("a"));
//        System.out.println(queue.offer("b"));
//        System.out.println(queue.offer("c"));
//        System.out.println(queue.offer("d"));
//        System.out.println(queue.poll());
//        System.out.println(queue.poll());
//        System.out.println(queue.poll());
//        System.out.println(queue.poll());

        queue.put("a");
        queue.put("a");
        queue.put("a");
//        queue.put("a");
        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println(queue.take());

    }
}
